/********************************************************************************
do-file to replicate tables in:
	Chacon, Mario and Jeff Jensen. 2019. "Democratization, De Facto Power, and Taxation: 
	Evidence from Military Occupation during Reconstruction" World Politics 

data file needed: Dataset_1 (Main Panel) 
*/

clear all 
set more off

**Set Working Directory 
*cd "C:\****\ Replication Files (Chacon & Jensen, WP 2019)\Datasets\"

use Dataset_1, clear 

*** Table 1. Descriptive Stats. 
sort d_occup_recon
*A
by d_occup_recon: sum state_tax_real_pc if sample==1 & year==1860
by d_occup_recon: sum state_tax_real_pc county_tax_real_pc if sample==1 & year>=1870
by d_occup_recon: sum del3_ln_state_tax_real_pc del2_ln_county_tax_real_pc if sample==1 & year==1890
*B
by d_occup_recon: sum black_sh_1860 tot_pop_1860 pop_density_1860  ///
farms_value_1860_real_pc wealth_1860_real_pc landgini_1860 if sample==1 

*C
by d_occup_recon: sum agri_gdp_1870_real_pc manu_gdp_1870_real_pc rri_house_1870 lnDisStCap ln_ELEV_AVG if sample==1
by d_occup_recon: sum del2_ln_tot_pop if year==1890 & sample==1

*** Table A4. Event Study Models 
**State Revenues (c1-c2)
global bs i_black_sh_1860_yr2 i_black_sh_1860_yr3 i_black_sh_1860_yr4 ///
i_black_sh_1860_DORecon_yr2 i_black_sh_1860_DORecon_yr3 i_black_sh_1860_DORecon_yr4
 
global occ i_DORecon_yr2 i_DORecon_yr3 i_DORecon_yr4

global pop i_lnTotPop1860_yr2 i_lnTotPop1860_yr3 i_lnTotPop1860_yr4 ///
i_lnTotPop1860_DORecon_yr2 i_lnTotPop1860_DORecon_yr3 i_lnTotPop1860_DORecon_yr4 ///

global farm i_lnFarValRPc1860_yr2 i_lnFarValRPc1860_yr3 i_lnFarValRPc1860_yr4 ///
i_lnFarValRPc1860_DORecon_yr2 i_lnFarValRPc1860_DORecon_yr3 i_lnFarValRPc1860_DORecon_yr4

set more off 
xtreg ln_state_tax_real_pc $bs $occ $pop $farm i_st1_yr1-i_st16_yr4 if sample==1, fe cluster(countyfips) 
outreg2 using Table_A4.xls, ctitle("Table 2, State Rev., Baseline") keep($bs) dec(3) nocons noast replace 

global agr i_lnAgriGdpRPc1870_yr2 i_lnAgriGdpRPc1870_yr3 i_lnAgriGdpRPc1870_yr4 ///
i_lnAgriGdpRPc1870_DORecon_yr2 i_lnAgriGdpRPc1870_DORecon_yr3 i_lnAgriGdpRPc1870_DORecon_yr4

global manu i_lnManGdpRPc1870_yr2 i_lnManGdpRPc1870_yr3 i_lnManGdpRPc1870_yr4 ///
i_lnManGdpRPc1870_DORecon_yr2 i_lnManGdpRPc1870_DORecon_yr3 i_lnManGdpRPc1870_DORecon_yr4

xtreg ln_state_tax_real_pc $bs $occ $pop $farm $agr $manu i_st1_yr1-i_st16_yr4 if sample==1, fe cluster(countyfips)
outreg2 using Table_A4.xls, ctitle("Table 2, State Rev., + 1870 GDP ") keep($bs) dec(3) noast nocons   

** Local (c3-c4)
global bs2  i_black_sh_1860_yr3 i_black_sh_1860_yr4 ///
i_black_sh_1860_DORecon_yr3 i_black_sh_1860_DORecon_yr4

global occ2  i_DORecon_yr3 i_DORecon_yr4

global pop2  i_lnTotPop1860_yr3 i_lnTotPop1860_yr4 ///
i_lnTotPop1860_DORecon_yr3 i_lnTotPop1860_DORecon_yr4 ///

global farm2 i_lnFarValRPc1860_yr3 i_lnFarValRPc1860_yr4 ///
i_lnFarValRPc1860_DORecon_yr3 i_lnFarValRPc1860_DORecon_yr4

xtreg ln_county_tax_real_pc $bs2 $occ2 $pop2 $farm2 i_st1_yr1-i_st16_yr4 if sample==1, fe cluster(countyfips)
outreg2 using Table_A4.xls, ctitle("Table 2, County Rev., Baseline") keep($bs) dec(3) noast nocons 

global agr2 i_lnAgriGdpRPc1870_yr3 i_lnAgriGdpRPc1870_yr4 ///
i_lnAgriGdpRPc1870_DORecon_yr3 i_lnAgriGdpRPc1870_DORecon_yr4

global manu2  i_lnManGdpRPc1870_yr3 i_lnManGdpRPc1870_yr4 ///
i_lnManGdpRPc1870_DORecon_yr3 i_lnManGdpRPc1870_DORecon_yr4

xtreg ln_county_tax_real_pc $bs2 $occ2 $pop2 $farm2 $agr2 $manu2 i_st1_yr1-i_st16_yr4 if sample==1, fe cluster(countyfips)
outreg2 using Table_A4.xls, ctitle("Table 2, County Rev., + 1870 GDP") keep($bs) dec(3) noast nocons 

** Total Non-Federal (c5-c6)  
xtreg ln_total_tax_real_pc $bs2 $occ2 $pop2 $farm2  i_st1_yr1-i_st16_yr4 if sample==1, fe cluster(countyfips)
outreg2 using Table_A4.xls, ctitle("Table 2, Tot. Non-Nat. Rev., Baseline Cont.") keep($bs) dec(3) noast nocons 

xtreg ln_total_tax_real_pc $bs2 $occ2 $pop2 $farm2 $agr2 $manu2 i_st1_yr1-i_st16_yr4 if sample==1, fe cluster(countyfips)
outreg2 using Table_A4.xls, ctitle("Table 2, Tot. Non-Nat. Rev., + 1870 GDP") keep($bs) dec(3) noast nocons 

*** Table 2. Long-Difference Models 
global ldc lnTotPop1860 i_lnTotPop1860_DORecon ///
lnFarValRPc1860 i_lnFarValRPc1860_DORecon 

global ldc2 lnAgriGdpRPc1870 i_lnAgriGdpRPc1870_DORecon ///
lnManGdpRPc1870 i_lnManGdpRPc1870_DORecon

** State  
* 1860-1870 (c1-c2)
reg del_ln_state_tax_real_pc i_black_sh_1860_DORecon black_sh_1860 d_occup_recon $ldc st1-st16 if sample==1 & year==1870, r
outreg2 using Table_2.xls, ctitle("Table 3, St. Rev. 1860-70, Baseline") keep(i_black_sh_1860_DORecon black_sh_1860 d_occup_recon) dec(3) noast replace 

reg del_ln_state_tax_real_pc i_black_sh_1860_DORecon black_sh_1860 d_occup_recon $ldc $ldc2 st1-st16 if sample==1 & year==1870, r
outreg2 using Table_2.xls, ctitle("Table 3, St. Rev. 1860-70, + 1870 GDP") keep(i_black_sh_1860_DORecon black_sh_1860 d_occup_recon) dec(3) noast

* 1870-1890 (c3-c4) 
reg del2_ln_state_tax_real_pc i_black_sh_1860_DORecon black_sh_1860 d_occup_recon $ldc st1-st16 if sample==1 & year==1890, r
outreg2 using Table_2.xls, ctitle("Table 3, St. Rev. 1870-90, Baseline") keep(i_black_sh_1860_DORecon black_sh_1860 d_occup_recon) dec(3) noast

reg del2_ln_state_tax_real_pc i_black_sh_1860_DORecon black_sh_1860 d_occup_recon $ldc $ldc2 st1-st16 if sample==1 & year==1890, r
outreg2 using Table_2.xls, ctitle("Table 3, St. Rev. 1870-90, + 1870 GDP") keep(i_black_sh_1860_DORecon black_sh_1860 d_occup_recon) dec(3) noast

** County (c5-c6) 
reg del2_ln_county_tax_real_pc i_black_sh_1860_DORecon black_sh_1860 d_occup_recon $ldc  st1-st16 if sample==1 & year==1890, r
outreg2 using Table_2.xls, ctitle("Table 3, Coun. Rev. 1870-90, Baseline") keep(i_black_sh_1860_DORecon black_sh_1860 d_occup_recon) dec(3) noast

reg del2_ln_county_tax_real_pc i_black_sh_1860_DORecon black_sh_1860 d_occup_recon $ldc $ldc2 st1-st16 if sample==1 & year==1890, r
outreg2 using Table_2.xls, ctitle("Table 3, Coun. Rev. 1870-90, +1870 GDP") keep(i_black_sh_1860_DORecon black_sh_1860 d_occup_recon) dec(3) noast

** Total Non-federal (c7-c8)  
reg del2_ln_total_tax_real_pc i_black_sh_1860_DORecon black_sh_1860 d_occup_recon $ldc  st1-st16 if sample==1 & year==1890, r
outreg2 using Table_2.xls, ctitle("Table 3, Tot. Rev. 1870-90, Baseline") keep(i_black_sh_1860_DORecon black_sh_1860 d_occup_recon) dec(3) noast

reg del2_ln_total_tax_real_pc i_black_sh_1860_DORecon black_sh_1860 d_occup_recon $ldc $ldc2 st1-st16 if sample==1 & year==1890, r
outreg2 using Table_2.xls, ctitle("Table 3, Tot. Rev. 1870-90, Baseline + GDP") keep(i_black_sh_1860_DORecon black_sh_1860 d_occup_recon) dec(3) noast
